<%--
  Created by IntelliJ IDEA.
  User: 14258
  Date: 2020/9/1
  Time: 17:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" errorPage="test.jsp" language="java" pageEncoding="UTF-8" %>
<html>
  <head>
    <title>JSP练习</title>
  </head>
  <body>
  <%! String a = "测试";%>
  <%! public String getA(){
    return a;
  }%>
  <%= a%>
  <%-- jsp存值 --%>
  <%request.setAttribute("req","request的值");
    session.setAttribute("sessionKey","sessionKey的值");
    application.setAttribute("app","application的值");
//    out.print("<script>alert('aa');</script>");
    pageContext.setAttribute("pageCon","pageContext的值");
  %>
  <hr>
  Java脚本的方式获取值：<br>
  <%= request.getAttribute("req")%>
  <%= session.getAttribute("sessionKey")%>
  <%= application.getAttribute("app")%>
  <%= pageContext.getAttribute("pageCon")%>
  <hr>
  EL表达式获取值：<br>
  ${req},${sessionKey},${applicationScope.app},${pageCon}
  </body>
</html>
